package cn.bsb.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.bsb.pojo.DevUser;
import tk.mybatis.mapper.common.Mapper;

public interface DevUserMapper extends Mapper<DevUser> {
	@Select("select * from dev_user where user_code=#{user_code} and `userPassword`=#{userPassword}")
	public DevUser findOne(@Param("user_code") String userCode,@Param("userPassword") String userPassword);
	
	@Insert("INSERT INTO dev_user (user_code,user_name,userPassword,sex,birthday,email,mobile,address,creattime,pic) VALUES(#{user_code},#{user_name},#{userPassword},#{sex},#{birthday},#{email},#{mobile},#{address},#{creattime},#{pic}) ")
	public int addUser(DevUser devUser);
	
	//查询一个用户列表
	@Select("select * from dev_user")
	public List<DevUser> getList();
	
	//根据id查询
	@Select("SELECT * FROM dev_user WHERE id=#{id}")
	public DevUser getUser(@Param("id") Integer id);
	
	public int updateUser(DevUser user);
	
	@Select("SELECT * FROM dev_user AS d WHERE d.user_code=#{user_code}")
	public DevUser getUserCodeByuser_Code(@Param("user_code")String user_code);
}
